import { createRouter, createWebHistory } from 'vue-router'
const routes =[
  {
    path:'/',
    component:()=>import('@/views/Shouye.vue')
  },
  {
    path:'/ProjectMange',
    component:()=>import('@/views/ProjectMange.vue')
  },
  {
    path:'/Budget',
    component:()=>import('@/views/Budget.vue')
  },
  {
    path:'/Book',
    component:()=>import('@/views/Book.vue')
  },
  {
    path:'/MaterialBuy',
    component:()=>import('@/views/MaterialBuy.vue')
  },
  {
    path:'/ProjHospital',
    component:()=>import('@/views/ProjHospital.vue')
  },
  {
    path:'/Money',
    component:()=>import('@/views/Money.vue')
  },
  {
    path:'/Original',
    component:()=>import('@/views/Original.vue')
  },
  {
    path:'/FinnalProj',
    component:()=>import('@/views/FinnalProj.vue')
  }
]
const router=createRouter({
  history:createWebHistory(),
  routes,
})
var num =false
router.beforeEach((to,from, next) => {
  // 如果当前路径不是首页，自动跳转到首页
  if (to.path !== '/'&& !num) {
    next('/');
    num=true
  } else {
    next();
  }
});
export default router
